package com.drugStorage.spring.ServiceImpl;

import java.util.List;

import com.drugStorage.domain.User;
import com.drugStorage.hibernate.dao.UserDao;
import com.drugStorage.spring.service.UserService;

public class UserServiceImpl implements UserService {

	private UserDao userDao;
	private User user;

	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao UserDao) {
		this.userDao = UserDao;
	}

	public void saveUser(User user) {

		this.userDao.saveUser(user);

	}

	public void removeUser(String id) {
		User user = this.userDao.getUser(id);
		this.userDao.removeUser(user);
	}

	public List getAllUsers(User user) {
		List list = null;
		list = this.userDao.findByUsername(user);
		return list;
	}

	public User getUser(String id) {
		User user = this.userDao.getUser(id);
		return user;
	}

	public void updateUser(User user) {	
		this.userDao.updateUser(user);

	}

	public void del(String[] userList) {
		this.userDao.delObject(userList);
		
	}

	public User findByName(String name) {
		User user = this.userDao.getByName(name);
	return user;
	}

}
